<?php

class GoSharkFindGroup extends GofishGroups
{
    public function find_group_callback($validator, $values)
        {
            $find_group = Doctrine_Query::create()
                ->from('GofishGroups gg')
                ->where('gg.group_name = ?', $values['group_name'])
                ->count();
                
            if ($find_group > 1)
            {
                throw new sfValidatorError($validator, "Several groups found, be more specific.");
            }
            if (!$find_group)
            {
                throw new sfValidatorError($validator, "No groups found.");
            }
            
            return $values;
        }
}

?>